from os import path
import configparser
# -*- coding:utf-8  -*-
# @Time    : 2021/5/16 23:08
__author__ = 'wangd'

# now_base_path = path.abspath(path.dirname(__file__))
cf = configparser.ConfigParser()


def uploadIpFile(ip, filepath):
    cf.read("test2.ini")
    sections = cf.sections()
    if sections is [] or ip not in sections:
        cf.add_section(ip)
    cf.set(ip, ip, filepath)
    cf.remove_option(ip, filepath)
    with open("test2.ini", "w+") as f:
        cf.write(f)
